
#include "wds_app.h"
#include "build.h"

#include "application/game_rms.h"
#include "util/log.h"				// log

#ifdef _PLATFORM_WIN32
int WINAPI WinMain ( HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow )
#else

int main(int argc,char *argv[])
#endif
{
	const std::string Name = std::string(BUILD_NAME) + " : " + BUILD_ID + "               (Built on " + __DATE__ + " )";
    
	// 1024 , 576 ( SIII ratio .. down to 1024 size )
	
	 //iPhone4
	// float	Width = 640; float   Height =  960;

	//iPhone5
	//float	Width = 1136; float   Height =  640;// Width *= (1024.0f/Height); Height *= (1024.0f/Height);

	// my poor 3GS
	// float	Width = 320; float   Height =  480; 
    
	// iPad
	// float	Width = 1536; float   Height = 2048; Width *= (1024.0f/Height); Height *= (1024.0f/Height);

	// SIII
	// float Width = 720.0f; float Height = 1280.0f; Width *= (1024.0f/Height); Height *= (1024.0f/Height);

	// SII
	// float Width = 480.0f; float Height = 800.0f;

	// Galaxy Tab III
	//float Width = 800.0f; float Height = 1280.0f; Width *= (1024.0f/Height); Height *= (1024.0f/Height);


	// custom
	float	Width = 1280; float   Height = 720;
	//float	Width = 720; float   Height = 720;
	 	

    
#ifdef _PLATFORM_WIN32
	GENWin32Handler*	pHandler = new GENWin32Handler(hInst);
#else
    
	GENWin32Handler*	pHandler = new GENWin32Handler();
#endif
	
	
	if (!pHandler->InitWindow(Name, Name, 0, 0, (int)Width,(int)Height))
	{
		return -1;
	}
 
	std::string Path	= pHandler->GetSaveFolder();
	std::string Log		= Path + "mt5.log";
	std::string Config	= Path + "mt5.lua";
    
	g_pApp = new MT5App (pHandler, Config, Log);
	g_pApp->Init();
    
	//Fighter::Instance().SetScale(0.6f);   
	while (g_pApp->Tick())
	{
	};
    
	_LOG(MSG_INIT, "About to quit normally");
	g_pApp->GetRMS()->Save();
	g_pApp->Shutdown();
	UTIL_SAFE_DELETE(g_pApp);
	return 1;
}
 
